import requests
import jsonpath
import json

url = "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal"

payload = "{\n    \"app_id\": \"cli_a7936c8e8f78500d\",\n    \"app_secret\": \"V9OBeDKcWDzq48q3Q2VNHgrzBkNCRewf\"\n}"
headers = {
    'User-Agent': 'Apifox/1.0.0 (https://apifox.com)',
    'Content-Type': '"application/json; charset=utf-8"'
}

response = requests.request("POST", url, headers=headers, data=payload)
print(response.json())
r1 = response.json()
r3 = dict(r1)
r2 = r3.get("tenant_access_token")

print(r2)

url = "https://open.feishu.cn/open-apis/bitable/v1/apps/W1aibDrHWa1LaysJPOHcRRtfnrc/tables/tblprqyXdIY1Nfzw/records"
A = "阿其那"
B = 1727762120
C = "19622222222"
# payload = "{\r\n    \"fields\": {\r\n        \"姓名\": \"二赖子\",\r\n        \"出生日期\": 1727762120,\r\n        \"手机号码\": \"19622222222\"\r\n    }\r\n}"
payload1 = {
    "fields": {
        "姓名": A,
        "出生日期": B,
        "手机号码": C
    }
}
payload = json.dumps(payload1)
headers = {
    'User-Agent': 'Apifox/1.0.0 (https://apifox.com)',
    'Content-Type': '"application/json; charset=utf-8"',
    'Authorization': f'Bearer {r2}'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
